#include<iostream>
using namespace std;
int  n;
int main(){
	cin >> n;
	if(n == 0){return 0;}
	int ar[n];
	
	for(int i=0;i<n;i++){
		cin>>ar[i];
	}
	int re[n][n]={0};
	int i , j ,count;
	for(i = 0 ;i<n;i++){
		for(j = i,count = 0;count < 4;j++,count ++){
			re[i][j] = ar[count] ;
			
			if(j >= n){
				j = 0;
				re[i][j] = ar[count] ;
			}
		}
	}
	for(i = 0 ;i<n;i++){
		for(j = 0;j < n;j++){
			cout<<re[i][j];
			}
		cout<<endl;
	}
	return 0;
}
